/ Main Code Segment
*0200
Main, cla cll / clear AC and link
kcc / clear keyboard flag
tls / wake-up printer ? display unprintable null
Again,jms GetChar / read a character
dca Ch / store it
tad Ch / get the character and
tad MCR / check if it=s a CR
sna / if not skip next instruction
jmp Done / else done
cla cll / clear AC
tad Ch / and load character
jms Type / echo to screen
jmp Again / go again
Done, hlt
jmp Main
/ I/O routines
*0250
GetChar, 0 / return address here
ksf / is keyboard flag raised?
jmp .-1 / no - loop
krb / yes - read character to AC
jmp i GetChar / return
Type, 0 / return address here
tsk / is printer flag raised?
jmp .-1 / no - loop
tls / yes - print character
cla cll / clear AC and link
jmp i Type / return
/ Data Segment
*0300
Ch, 0 / character
MCR, 13d / minus ASCII code for CR
$Main